
import VueRouter from 'vue-router';

// 导入对应的路由组件
import HomeContainer from './components/tabbar/HomeContainer.vue';
import MemberContainer from './components/tabbar/MemberContainer.vue';
import SearchContainer from './components/tabbar/SearchContainer.vue';
import ShopContainer from './components/tabbar/ShopContainer.vue';
import newsList from './components/news/NewsList.vue';
import newsInfo from './components/news/NewsInfo.vue';
import PhotoList from './components/photos/photoList.vue';
import PhotoInfo from './components/photos/photoinfo.vue';
import GoodsList from './components/goods/GoodsList.vue';

// 3.创建路由对象
var router = new VueRouter({
  routes: [ // 配置路由规则的
    { path: '/', redirect: '/home' },
    { path: '/home', component: HomeContainer },
    { path: '/member', component: MemberContainer },
    { path: '/search', component: SearchContainer },
    { path: '/shopcar', component: ShopContainer },
    { path: '/home/newsList', component: newsList },
    // 路由传参数在对应组件及其子组件使用this.$route.params.id/this.$route.query.id均能访问
    { path: '/home/newsinfo/:id', component: newsInfo },
    { path: '/home/photolist', component: PhotoList },
    { path: '/home/photoinfo/:id', component: PhotoInfo }, 
    { path: '/home/goodslist', component: GoodsList }
  ],
  linkActiveClass: ' mui-active' //覆盖默认的路由高亮的类，默认的类叫做router-link-active  只对跟根组件有用
});
// 把路由对象暴露出去
export default router;